package com.saturn.action.sldb.discussion;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.saturn.app.utils.BeanUtils;
import com.saturn.app.web.IAction;
import com.saturn.app.web.IView;
import com.saturn.app.web.view.JspErrorView;
import com.saturn.app.web.view.JspView;
import com.saturn.sldb.Discussion;

public class AddDiscusstionAction implements IAction{
	@Override
	public IView execute(HttpServletRequest request,
			HttpServletResponse response) {
		Discussion vo = BeanUtils.getBean(request, Discussion.class);
		String type = request.getParameter("inputType");
		if("手动".equals(type)){
			vo.setInputType("手动");
			if (Discussion.add(vo) == 1) {
				return new JspView("/app/sldb/discussion/apply/show.jsp");
			} else {
				return new JspErrorView("添加申报救助信息失败");
			}
		}else{
				vo.setInputType("自动");
				if (Discussion.add(vo) == 1) {
					return new JspView("/app/sldb/discussion/apply/autoShow.jsp");
				} else {
					return new JspErrorView("添加申报救助信息失败");
				}
			}
		}
	@Override
	public String requestMapping() {
		return "/app/sldb/discussion/apply/addDiscussion.action";
	}
}
